package com.example.board_jojo;

import android.app.Activity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.widget.TextView;

public class DeleteActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_delete);
		
		TextView tv_sy1 = (TextView)findViewById(R.id.textView1);
		TextView tv_sy2 = (TextView)findViewById(R.id.textView2);
		TextView tv_sy3 = (TextView)findViewById(R.id.textView3);
		
		registerForContextMenu(tv_sy1);
		registerForContextMenu(tv_sy2);
		registerForContextMenu(tv_sy3);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		new MainOptionMenu(this, item);
		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) {
		int id = v.getId();
		switch(id){
		case R.id.textView1:
			menu.add(0,1,0, "우유한잔");
			menu.add(0,2,0, "삼겹살");
			break;
		case R.id.textView2:
			menu.add(0,3,0, "불갈비");
			menu.add(0,4,0, "짜장");
			menu.add(0,5,0, "칼만두");
			break;
		case R.id.textView3:
			SubMenu sm1 = menu.addSubMenu("단지밥?");
			SubMenu sm2 = menu.addSubMenu("술과함게?");
			
			sm1.add(0,6,0, "백반");
			sm1.add(0,7,0, "햄버거");
			
			sm2.add(0,8,0, "소주와 삼겹살");
			sm2.add(0,9,0, "치맥으로~");
			break;
			
		}
		super.onCreateContextMenu(menu, v, menuInfo);
	}

	@Override
	public boolean onContextItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		return super.onContextItemSelected(item);
	}
}

